hook up the destroy handler. (gtk_expander_destroy),
authorMark McLoughlin <mark@skynet.ie>
Tue, 28 Oct 2003 15:32:21 +0000 (15:32 +0000)
committerMark McLoughlin <markmc@src.gnome.org>
Tue, 28 Oct 2003 15:32:21 +0000 (15:32 +0000)
2003-10-28  Mark McLoughlin  <mark@skynet.ie>

        * gtk/gtkexpander.c:
        (gtk_expander_class_init): hook up the destroy handler.
        (gtk_expander_destroy), (gtk_expander_unrealize):
        remove the expand/collapse timeout on destroy instead
        of unrealize to avoid leaving the expander in a inconsistent
        state when unrealizing during animation.
        (gtk_expander_start_animation): remove realized check.
        (gtk_expander_set_expanded): if the widget isn't realized,
        expand immediately.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkexpander.c

index 81db898015456f3117f5b082ffba08a9e4cf390c..120c6cc7bfff59befdc845f17e7c67744293e013 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-10-28  Mark McLoughlin  <mark@skynet.ie>
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_class_init): hook up the destroy handler.
+       (gtk_expander_destroy), (gtk_expander_unrealize):
+       remove the expand/collapse timeout on destroy instead
+       of unrealize to avoid leaving the expander in a inconsistent
+       state when unrealizing during animation.
+       (gtk_expander_start_animation): remove realized check.
+       (gtk_expander_set_expanded): if the widget isn't realized,
+       expand immediately.
+
 Tue Oct 28 09:44:16 2003  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently
index 81db898015456f3117f5b082ffba08a9e4cf390c..120c6cc7bfff59befdc845f17e7c67744293e013 100644 (file)
@@ -1,3 +1,15 @@
+2003-10-28  Mark McLoughlin  <mark@skynet.ie>
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_class_init): hook up the destroy handler.
+       (gtk_expander_destroy), (gtk_expander_unrealize):
+       remove the expand/collapse timeout on destroy instead
+       of unrealize to avoid leaving the expander in a inconsistent
+       state when unrealizing during animation.
+       (gtk_expander_start_animation): remove realized check.
+       (gtk_expander_set_expanded): if the widget isn't realized,
+       expand immediately.
+
 Tue Oct 28 09:44:16 2003  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently
index 81db898015456f3117f5b082ffba08a9e4cf390c..120c6cc7bfff59befdc845f17e7c67744293e013 100644 (file)
@@ -1,3 +1,15 @@
+2003-10-28  Mark McLoughlin  <mark@skynet.ie>
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_class_init): hook up the destroy handler.
+       (gtk_expander_destroy), (gtk_expander_unrealize):
+       remove the expand/collapse timeout on destroy instead
+       of unrealize to avoid leaving the expander in a inconsistent
+       state when unrealizing during animation.
+       (gtk_expander_start_animation): remove realized check.
+       (gtk_expander_set_expanded): if the widget isn't realized,
+       expand immediately.
+
 Tue Oct 28 09:44:16 2003  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently
index 81db898015456f3117f5b082ffba08a9e4cf390c..120c6cc7bfff59befdc845f17e7c67744293e013 100644 (file)
@@ -1,3 +1,15 @@
+2003-10-28  Mark McLoughlin  <mark@skynet.ie>
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_class_init): hook up the destroy handler.
+       (gtk_expander_destroy), (gtk_expander_unrealize):
+       remove the expand/collapse timeout on destroy instead
+       of unrealize to avoid leaving the expander in a inconsistent
+       state when unrealizing during animation.
+       (gtk_expander_start_animation): remove realized check.
+       (gtk_expander_set_expanded): if the widget isn't realized,
+       expand immediately.
+
 Tue Oct 28 09:44:16 2003  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently
index 81db898015456f3117f5b082ffba08a9e4cf390c..120c6cc7bfff59befdc845f17e7c67744293e013 100644 (file)
@@ -1,3 +1,15 @@
+2003-10-28  Mark McLoughlin  <mark@skynet.ie>
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_class_init): hook up the destroy handler.
+       (gtk_expander_destroy), (gtk_expander_unrealize):
+       remove the expand/collapse timeout on destroy instead
+       of unrealize to avoid leaving the expander in a inconsistent
+       state when unrealizing during animation.
+       (gtk_expander_start_animation): remove realized check.
+       (gtk_expander_set_expanded): if the widget isn't realized,
+       expand immediately.
+
 Tue Oct 28 09:44:16 2003  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently
index 4f44baa68b1ffda25ec66b0858dc51f9b600c347..8f739f02782aeb6d0bd4ded78e2a472cff6fddb0 100644 (file)
@@ -75,6 +75,8 @@ static void gtk_expander_get_property (GObject          *object,
                                       GValue           *value,
                                       GParamSpec       *pspec);
 
+static void gtk_expander_destroy (GtkObject *object);
+
 static void     gtk_expander_realize        (GtkWidget        *widget);
 static void     gtk_expander_unrealize      (GtkWidget        *widget);
 static void     gtk_expander_size_request   (GtkWidget        *widget,
@@ -145,18 +147,22 @@ static void
 gtk_expander_class_init (GtkExpanderClass *klass)
 {
   GObjectClass *gobject_class;
+  GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;
   GtkContainerClass *container_class;
 
   parent_class = g_type_class_peek_parent (klass);
 
   gobject_class   = (GObjectClass *) klass;
+  object_class    = (GtkObjectClass *) klass;
   widget_class    = (GtkWidgetClass *) klass;
   container_class = (GtkContainerClass *) klass;
 
   gobject_class->set_property = gtk_expander_set_property;
   gobject_class->get_property = gtk_expander_get_property;
 
+  object_class->destroy = gtk_expander_destroy;
+
   widget_class->realize              = gtk_expander_realize;
   widget_class->unrealize            = gtk_expander_unrealize;
   widget_class->size_request         = gtk_expander_size_request;
@@ -338,6 +344,20 @@ gtk_expander_get_property (GObject    *object,
     }
 }
 
+static void
+gtk_expander_destroy (GtkObject *object)
+{
+  GtkExpanderPrivate *priv = GTK_EXPANDER (object)->priv;
+  
+  if (priv->animation_timeout)
+    {
+      g_source_remove (priv->animation_timeout);
+      priv->animation_timeout = 0;
+    }
+  
+  GTK_OBJECT_CLASS (parent_class)->destroy (object);
+}
+
 static void
 gtk_expander_realize (GtkWidget *widget)
 {
@@ -388,12 +408,6 @@ gtk_expander_unrealize (GtkWidget *widget)
       priv->event_window = NULL;
     }
 
-  if (priv->animation_timeout)
-    {
-      g_source_remove (priv->animation_timeout);
-      priv->animation_timeout = 0;
-    }
-      
   GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
 }
 
@@ -1176,9 +1190,6 @@ gtk_expander_start_animation (GtkExpander *expander)
 {
   GtkExpanderPrivate *priv = expander->priv;
 
-  if (!GTK_WIDGET_REALIZED (expander))
-    return;
-
   if (priv->animation_timeout)
     g_source_remove (priv->animation_timeout);
 
@@ -1215,15 +1226,20 @@ gtk_expander_set_expanded (GtkExpander *expander,
     {
       priv->expanded = expanded;
 
-      if (GTK_WIDGET_VISIBLE (expander))
-       gtk_expander_start_animation (expander);
-
-      else if (GTK_BIN (expander)->child)
+      if (GTK_WIDGET_REALIZED (expander))
+       {
+         gtk_expander_start_animation (expander);
+       }
+      else 
        {
          priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
                                            GTK_EXPANDER_COLLAPSED;
-         gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
-         gtk_widget_queue_resize (GTK_WIDGET (expander));
+
+         if (GTK_BIN (expander)->child)
+           {
+             gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
+             gtk_widget_queue_resize (GTK_WIDGET (expander));
+           }
        }
 
       g_object_notify (G_OBJECT (expander), "expanded");